<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>煤炭管理系统</title>
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/lib/layui/css/layui-theme-custom.css">
    <link rel="stylesheet" href="/static/css/member.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <#include "../base/main-header.ftl">

    <#include "../base/main-left.ftl">
    <div class="layui-body">
        <!-- 内容主体区域  -->
        <div class="site-title">
            <fieldset>
                <legend>
                    <a class="site-title-text">重置用户密码</a>
                </legend>
            </fieldset>
        </div>
        <div class="table-box">
            <div class="site-text site-block">
                <form  class="layui-form">

                    <div class="layui-form-item">
                        <label for="memberName" class="layui-form-label label-width">用户名：</label>
                        <div class="layui-input-block">
                            <input type="text" name="userName" class="layui-input input-width" value="${psduser.username}" disabled>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="name" class="layui-form-label label-width">姓名：</label>
                        <div class="layui-input-block">
                            <input type="text" name="nickName" class="layui-input input-width" value="${psduser.nickName}" disabled>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-top: 100px">
                            <button class="layui-btn layui-btn-radius  layui-btn-danger"   id="resetPWD">重置密码</button>
                            <a href="/member"><button type="button" style="margin-left: 30px" class="layui-btn layui-btn-radius layui-btn-primary">返回</button></a>
                        </div>
                    </div>
                </form>
            </div>
        </div>

    </div>
    <#include "../base/main-footer.ftl">
</div>

<script src="/static/lib/layui/layui.js"></script>
<script>
    layui.use(['layer', 'form', 'element', 'jquery'], function () {
        let layer = layui.layer, form = layui.form, $ = layui.jquery;

        $("#resetPWD").click(function () {
            layer.confirm('确认重置密码?该操作将发送初始化密码到用户邮箱!', function () {
                $.ajax({
                    type: "post",
                    url: "/resetPWD.do/${RequestParameters['id']}",
                    contentType: "application/json;charset=utf-8",
                    success: function (message) {
                        if (message.isSuccess) {
                            layer.msg("重置密码成功");
                            setTimeout('window.location = "/member"', 500);
                        } else {
                            layer.alert(message.msg);
                        }
                    }
                });

                return false
            })
            return false
        });

    })
</script>
</body>
</html>